<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const arr1 = [11, 45, 32, 78, 3, 56, 13];
        //累加
        let result1 = arr1.reduce((prev, current) => {
            return prev + current
        }, 0)
        //过滤
        let result2 = arr1.reduce((prev, item) => {
            item >= 30 ? prev.push(current) : "";
            return prev
        }, [])
        //把url字符串查询字符串转对象 http://XXX.com?user=laowang&pass=123
        let url = 'http://XXX.com?user=laowang&pass=123'
        url.split('?')//['http://XXX.com',user=laowang&pass=123]
        url.split('?')[1].split('&').reduce((p,c)=>{
            let [value,key] = c.split('=');
            p[key] = value;
            return p;
        },{})
    </script>
</body>

</html>